#include <SFML/Window.hpp>
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <iostream>
#include <soil2/SOIL2.h>
#include "Display.hpp"

constexpr int width = 1000;
constexpr int height = 1000;


using namespace sf;
int main() {
  sf::Window window(sf::VideoMode({width, height}), "OpenGL");
  int gl = gladLoadGL();
  if (!gl) {
    std::cerr << "Failed to initialize GLAD\n";
    return -1;
  }
  window.setFramerateLimit(60);

  bool isRunning = true;
  // activate the window
  bool isActive = window.setActive(true);
  if (!isActive) {
    std::cerr << "Failed to set window active\n";
    return -1;
  }
  auto display = Display(window);
  while (isRunning) {
    while (auto e = window.pollEvent()) {
      if (e->is<sf::Event::Closed>()) {
        isRunning = false;
      }
      display.render();
    }
    // end the current frame (internally swaps the front and back buffers)
    window.display();
  }
  return 0;
}